<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" xmlns:th="www.thymeleaf.org" >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link type="text/css" rel="stylesheet" href="css/style.css" />
	<link type="text/css" rel="stylesheet" href="css/div-container.css" />
    <!--[if IE 6]>
    <script src="js/iepng.js" type="text/javascript"></script>
        <script type="text/javascript">
           EvPNG.fix('div, ul, img, li, input, a'); 
        </script>
    <![endif]-->    
    <script type="text/javascript" src="js/jquery-1.11.1.min_044d0927.js"></script>
	<script type="text/javascript" src="js/jquery.bxslider_e88acd1b.js"></script>
    
    <script type="text/javascript" src="js/jquery-1.8.2.min.js"></script>
    <script type="text/javascript" src="js/menu.js"></script>    
        
	<script type="text/javascript" src="js/select.js"></script>
    
	<script type="text/javascript" src="js/lrscroll.js"></script>
    
    <script type="text/javascript" src="js/iban.js"></script>
    <script type="text/javascript" src="js/fban.js"></script>
    <script type="text/javascript" src="js/f_ban.js"></script>
    <script type="text/javascript" src="js/mban.js"></script>
    <script type="text/javascript" src="js/bban.js"></script>
    <script type="text/javascript" src="js/hban.js"></script>
    <script type="text/javascript" src="js/tban.js"></script>
    <script type="text/javascript" src="js/shade.js"></script>
	<script type="text/javascript" src="js/lrscroll_1.js"></script>
    
    
<title>尤洪</title>
</head>
<body>  
<!--Begin Header Begin-->
<div class="soubg">
	<div class="sou">
        <span class="fr">
        	<span class="fl">你好，请<a href="Login.html">登录</a>&nbsp; <a href="Regist.html" style="color:#ff4e00;">免费注册</a>&nbsp; </span>
            <span class="fl">|&nbsp;关注我们：</span>
            <span class="s_sh"><a href="#" class="sh1">新浪</a><a href="#" class="sh2">微信</a></span>
            <span class="fr">|&nbsp;<a href="#">手机版&nbsp;<img src="images/s_tel.png" align="absmiddle" /></a></span>
        </span>
    </div>
</div>
<!--End Header End--> 
<!--Begin Login Begin-->
<div class="log_bg">	
    <div class="top">
        <div class="logo"><a href="Index.html"><img src="images/logo.png" /></a></div>
    </div>
	<div class="login">
    	<div class="log_img"><img src="images/l_img.png" width="611" height="425" /></div>
		<div class="log_c">
        	<form action="loginNow.do" method="post">
            <table border="0" style="width:370px; font-size:14px; margin-top:30px;" cellspacing="0" cellpadding="0">
              <tr height="50" valign="top">
              	<td width="55">&nbsp;</td>
                <td>
                	<span class="fl" style="font-size:24px;">登录</span>
                    <span class="fr">还没有商城账号，<a href="toRegist.do" style="color:#ff4e00;">立即注册</a></span>
                </td>
              </tr>
              <tr height="70">
                <td>用户名</td>
                <td><input type="text" name="loginName" placeholder="请输入用户名"  class="l_user" required="required" th:each="cookie:${#httpServletRequest.getCookies()}" th:if="${cookie.getName() == 'name'}" th:value="${cookie.getValue()}"/></td>
              </tr>
              <tr height="70">
                <td>密&nbsp; &nbsp; 码</td>
                <td><input type="password" name="pwd" placeholder="请输入密码" value="" class="l_pwd" required="required" th:each="cookie:${#httpServletRequest.getCookies()}" th:if="${cookie.getName() == 'pwd'}" th:value="${cookie.getValue()}"/></td>
              </tr>
              <tr height="70">
                <td>验证码</td>
                <td>
                	<input id="code" placeholder="验证码" type="text" name="loginVerifyCode" value="" class="l_verifyCode" required="required"/>
                	<img onclick="javascript:getvCode()" id="verifyimg" style="margin-left: 20px;"/>
                </td>
              </tr>
              <tr>
              	<td>&nbsp;</td>
                <td style="font-size:12px; padding-top:20px;">
                	<span style="font-family:'宋体';" class="fl">
                    	<label class="r_rad"><input type="checkbox" name="remPwd" /></label><label class="r_txt">七日内记住密码</label>
                    </span>
                    <span class="fr"><a href="javascript:void(0)" onclick="ShowDiv('MyDiv','fade')" style="color:#ff4e00;">忘记密码</a></span>
                </td>
              </tr>
              <tr height="60">
              	<td>&nbsp;</td>
                <td><input type="submit" value="登录" class="log_btn" /></td>
              </tr>
            </table>
            </form>
        </div>
    </div>
</div>
<!--End Login End--> 
<!--Begin Footer Begin-->
<div class="btmbg">
    <div class="btm">
        备案/许可证编号：蜀ICP备12009302号-1-www.dingguagua.com   Copyright © 2015-2018 尤洪商城网 All Rights Reserved. 复制必究 , Technical Support: Dgg Group <br />
        <img src="images/b_1.gif" width="98" height="33" /><img src="images/b_2.gif" width="98" height="33" /><img src="images/b_3.gif" width="98" height="33" /><img src="images/b_4.gif" width="98" height="33" /><img src="images/b_5.gif" width="98" height="33" /><img src="images/b_6.gif" width="98" height="33" />
    </div>    	
</div>
<!--End Footer End -->
<div class="div-container" id="div-container" th:if="${result.sucess==0}"
	style="display: block;">
	<div class="div-child-container">
		<div class="div-child">
			<br /> <br /><br /> <span th:text="${result.message}"
				style="font-size: 35px; font-weight: bold;"></span>
			<div class="my-btn">
				<button class="btn btn-primary" id="confrim" onclick="confrim()">确认</button>
			</div>
		</div>
	</div>
</div>

<!--Begin 弹出层-删除商品 Begin-->
<div id="fade" class="black_overlay"></div>
<div id="MyDiv" class="white_content" style="top:20%">             
    <div class="white_d">
        <div class="notice_t">
            <span class="fr" style="margin-top:10px; cursor:pointer;" onclick="CloseDiv('MyDiv','fade')"><img src="images/close.gif" /></span>
		</div>
		<div class="notice_c">
    		<table border="0" align="center" style="font-size:16px;text-align: right;border-collapse:separate; border-spacing:0px 10px;" cellspacing="0" cellpadding="0">
				<tr valign="top">
					<td>用户名：</td>
					<td><input type="text" name="resetUserName" id="resetUserName" placeholder="登录用户名" class="l_verifyCode" required /></td>
					<td><span id="resetUserNameTip" style="color: red" >&nbsp;</span></td>
				</tr>
				<tr valign="top" >
					<td>邮箱验证码：</td>
					<td><input type="text" name="resetEmailCode" id="resetEmailCode" placeholder="邮箱验证码" class="l_verifyCode"  required /></td>
					<td><button type="button" id="sendResetPWDEmailButton" class="b_buy" onclick="sendEmail(60000)" style="margin-left: 10px;">点击发送</button></td>
				</tr>
				<tr valign="top">
					<td>新密码：</td>
					<td><input type="password" name="resetUserPwd" id="resetUserPwd" placeholder="密码" class="l_verifyCode" required /></td>
					<td><span id="resetUserPwdTip" style="color: red" >&nbsp;</span></td>
				</tr>
				<tr valign="top">
					<td>确认密码：</td>
					<td><input type="password" name="resetUserPwdAgain" id="resetUserPwdAgain" placeholder="确认密码" class="l_verifyCode" required /></td>
					<td><span id="resetUserPwdAgainTip" style="color: red" >&nbsp;</span></td>
				</tr>
				<tr height="50" valign="bottom">
					<td><a href="javascript:void(0)" onclick="resetPWD()" class="b_sure">重置密码</a></td>
					<td>&nbsp;</td>
					<td><a href="javascript:void(0)" onclick="CloseDiv('MyDiv','fade')" class="b_buy">取消</a></td>
				</tr>
            </table>
                
        </div>
    </div>
</div>    
<!--End 弹出层-删除商品 End-->

<script type="text/javascript">
function resetPWD(){
	var userName=$('#resetUserName').val();
	var resetEmailCode = $('#resetEmailCode').val();
	var resetUserPwd = $('#resetUserPwd').val()
	var resetUserPwdAgain = $('#resetUserPwdAgain').val();
	if(userName == ''){
		$('#resetUserNameTip').html('请输入用户名');
		return;
	}else{
		$('#resetUserNameTip').html('');
	}
	if(resetEmailCode == ''){
		$('#resetUserNameTip').html($('#resetUserNameTip').html()+'，请输入验证码');
		return;
	}else{
		$('#resetUserNameTip').html('');
	}
	if(resetUserPwd == ''){
		$('#resetUserPwdTip').html('请输入密码');
		return;
	}else{
		$('#resetUserPwdTip').html('');
	}
	if(resetUserPwd == ''){
		$('#resetUserPwdAgainTip').html('请输入确认密码');
		return;
	}else if(resetUserPwd!=resetUserPwdAgain){
		$('#resetUserPwdAgainTip').html('输入的密码不一致');
		return;
	}else {
		$('#resetUserPwdAgainTip').html('');
	}
	
	$.post('resetPWD.do',{loginName:userName,resetEmailCode:resetEmailCode,resetUserPwd:resetUserPwd},function(data){
		if(data.sucess==1){
			$('#resetUserName').val('');
			$('#resetEmailCode').val('');
			$('#resetUserPwd').val('')
			$('#resetUserPwdAgain').val('');
			CloseDiv('MyDiv','fade');
		}else{
			$('#resetUserNameTip').html(data.message);
		}
	});
	
	
}

// 发送重置密码的邮件
function sendEmail(time){
	var userName=$('#resetUserName').val();
	if(userName == ''){
		$('#resetUserNameTip').html('请输入用户名');
		return;
	}
	$('#resetUserNameTip').html('');
	
	$('#sendResetPWDEmailButton').attr('disabled','disabled');
    setTimeout(function() {
        var x = setInterval(function(){
        		console.log(time)
                time= time - 1000; //reduce each second
                $('#sendResetPWDEmailButton').css('width','140px');
                $('#sendResetPWDEmailButton').html((time/1000)%60+'秒后可重新发送');
                if(time==0){
                        clearInterval(x);
                        $('#sendResetPWDEmailButton').css('width','118px');
                        $('#sendResetPWDEmailButton').html('点击发送');
                        $('#sendResetPWDEmailButton').removeAttr('disabled');
                }
        }, 1000);
    }, 1000);
    
	$.post('sendResetPwdEmail.do',{userName:userName},function(data){
		if(data.sucess==0){
			$('#resetUserNameTip').html(data.message);
		}
	});
}
</script>
<script type="text/javascript">
getvCode();

/**
 * 获取验证码
 * 将验证码写到login.html页面的id = verifyimg 的地方
 */
function getvCode() {
    document.getElementById("verifyimg").src = timestamp("logVerifyCode.do");
}
//为url添加时间戳
function timestamp(url) {
	var getTimestamp = new Date().getTime();
	if (url.indexOf("?") > -1) {
		url = url + "&timestamp=" + getTimestamp
	} else {
		url = url + "?timestamp=" + getTimestamp
    }
    return url;
};

/*将弹出框隐藏*/
function confrim(){
    var container = document.getElementById('div-container');
    container.style.display="none";
}
</script>
</body>


<!--[if IE 6]>
<script src="//letskillie6.googlecode.com/svn/trunk/2/zh_CN.js"></script>
<![endif]-->
</html>
